package exercise.exer2;

public class AnimalTest {

    public static void main(String[] args){
        AnimalTest test = new AnimalTest();

        test.adopt(new Dog());
        test.adopt(new Cat());

    }

    public void adopt(Animal animal){
        animal.eat();
        animal.shut();

        if(animal instanceof Cat){
            Cat cat = (Cat)animal;
            cat.catchMouse();
        }
        if(animal instanceof Dog){
            Dog dog = (Dog)animal;
            dog.guardHouse();
        }
    }
}
